<? include ("../init.php") ?>
<?php
  if(!isset($_GET['aid'])){
    redirect('index.php');
    exit();
  }
  $product_set_id = $_GET['aid'];
  
  function get_product_setname($product_set_id){
    $db2 = new DB(DB_NAME, DB_SERVER, DB_USER, DB_PWD);
    $db2->charset(DB_CHARSET);
    $sql = 'SELECT * FROM product_set WHERE product_set_id='.$product_set_id;
    $line = $db2->queryUniqueObject($sql);
    return $line->product_set_name;
  }
?>
<? include ("../header.php") ?>
<? include ("../menu.php") ?>
<? include ("submenu.php") ?>

<div id = "body">

<h1><?php echo get_product_setname($product_set_id); ?> : <?_l('add')?><?_l('product')?></h1>
<div class = "clear"></div>


<form method="post" action="add_product.php" class = "form" enctype="multipart/form-data">
  <input type="hidden" name="product_set_id" value="<?php echo $product_set_id; ?>" />
  <div class = "field"><label><?_l('product-name')?></label><input type = "text" name = "name" class = "input size1" ></div>
  <div class = "field"><label><?_l('overall-width')?></label><input type = "text" name = "width" class = "input size1" ></div>
  <div class = "field"><label><?_l('overall-depth')?></label><input type = "text" name = "depth" class = "input size1" ></div>
  <div class = "field"><label><?_l('height')?></label><input type = "text" name = "height" class = "input size1" ></div>
  <div class = "field"><label><?_l('material')?></label><input type = "text" name = "material" class = "input size2" ></div>
  <div class = "field"><label><?_l('detail')?></label><textarea name = "detail"></textarea></div>
  <div class = "field"><label><?_l('image')?></label><input type = "file" name = "img" class = "input size2" ></div>
  <div class = "field"><label><?_l('thumb')?>1</label><input type = "file" name = "img1" class = "input size2" ></div>
  <div class = "field"><label><?_l('thumb')?>2</label><input type = "file" name = "img2" class = "input size2" ></div>
  <div class = "field"><label><?_l('thumb')?>3</label><input type = "file" name = "img3" class = "input size2" ></div>
  <hr>
  <div class = "field"><label></label><input type = "submit" value = "<?=__l('add')?>" class = "btn">&nbsp;<a href = "#" class = "btn" onclick="javascript:history.back(1)"><?_l('cancel')?></a></div>
</form>

</div>

<style>
  .form label {
    width:80px;
  }
</style>
<script>
  $(document).ready(function(){
    $('#datepicker').datepicker({
      dateFormat: 'yy-mm-dd',
      changeMonth: true,
      changeYear: true
    });
  });
</script>
</div>
<? include "../footer.php" ?>